/*d21yK7OwFGk4wT1hwZAsrOHvJabY80RUP5i5XRWjxDedBY/0BfqR3SAO4W0x1DwH*/
/*
 * @Descripttion:
 * @version:
 * @Author: Chendch
 * @Date: 2019-06-08 15:55:18
 * @LastEditors: Chendch
 * @LastEditTime: 2021-06-10 15:59:56
 */
import { ajax } from 'nc-lightapp-front';

const queryAttachments =  '/nccloud/platform/attachment/query.do';

function getAttachmentsInfo(billId) {

	const params = {
		billId,
		fullPath: billId
	};
	return  new Promise((resolve, reject) => {

		ajax({
			url: queryAttachments,
			data: params,
			success: res => {
				let { success, data } = res;
				if (success) {
					if (Object.prototype.toString.call(data) === '[object Array]') {
						resolve(data);
					} else {
						resolve(res);
					}
				} else {
					console.warn('ajax请求错误');
					// eslint-disable-next-line prefer-promise-reject-errors
					reject('ajax请求错误');
				}
			}
		});
	});
}

export default getAttachmentsInfo;

/*d21yK7OwFGk4wT1hwZAsrOHvJabY80RUP5i5XRWjxDedBY/0BfqR3SAO4W0x1DwH*/
